<template>
  <!-- 2.定义echarts容器 -->
  <div class="echarts" ref="echarts"></div>
</template>
<script>
//1.引入echarts
import * as echarts from "echarts";
export default {
  name: "",
  data() {
    return {};
  },
  mounted() {
    //3.初始化echarts实例
    let lineCharts = echarts.init(this.$refs.echarts);
    //3.配置数据
    lineCharts.setOption({
      xAxis: {
        //隐藏x轴
        show: false,
        type: "category",
        min:0,
        max:100,
      },
      yAxis: {
        //隐藏y轴
        show: false,
      },
      series: [
        {
          type: "bar",
          data: [70],
          color:'cyan',
          //柱状图的宽度
          barWidth:600,
          //背景颜色设置
          showBackground:true,
          backgroundStyle:{
            color:"#eee"
          },
          //文本
          label:{
            show:true,
            formatter:'|',
            position:'right',
          }
        },
      ],
      //布局样式
      grid: {
        left: 0,
        top: 0,
        right: 0,
        bottom: 0,
      },
    });
  },
};
</script>
<style>
.echarts {
  width: 100%;
  height: 100%;
}
</style>